package com.nan.gbd.library.codec.configuration;

import android.content.Context;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

public class Configuration {
    private Context mContext;
    private int[] recordResolution;//视频录制分辨率
    private int recordCodeRate;//视频录制帧率
    private int[] liveResolution;//视频直播分辨率
    private int liveCodeRate;//视频直播帧率
    private int maxRecordFileLength;//录制文件最大长度
    private String recordPath;//录制文件地址
    private ConfigCallBack configCallBack;
    private static volatile Configuration instance;

    public static Configuration get() {
        if (null == instance) {
            synchronized (Configuration.class) {
                if (null == instance) {
                    instance = new Configuration();
                }
            }
        }
        return instance;
    }

    public Context getmContext() {
        return mContext;
    }

    public void setmContext(Context mContext) {
        this.mContext = mContext;
    }

    public int[] getRecordResolution() {
        return recordResolution;
    }

    public void setRecordResolution(int[] recordResolution) {
        this.recordResolution = recordResolution;
    }

    public int getRecordCodeRate() {
        return recordCodeRate;
    }

    public void setRecordCodeRate(int recordCodeRate) {
        this.recordCodeRate = recordCodeRate;
    }

    public int[] getLiveResolution() {
        return liveResolution;
    }

    public void setLiveResolution(int[] liveResolution) {
        this.liveResolution = liveResolution;
    }

    public int getLiveCodeRate() {
        return liveCodeRate;
    }

    public void setLiveCodeRate(int liveCodeRate) {
        this.liveCodeRate = liveCodeRate;
    }

    public int getMaxRecordFileLength() {
        return maxRecordFileLength;
    }

    public void setMaxRecordFileLength(int maxRecordFileLength) {
        this.maxRecordFileLength = maxRecordFileLength;
    }


    public String getRecordPath() {
        return recordPath;
    }

    public void setRecordPath(String recordPath) {
        this.recordPath = recordPath;
    }

    public void setConfigCallBack(ConfigCallBack configCallBack) {
        this.configCallBack = configCallBack;
    }

    public boolean isWritable() {
        if (configCallBack != null)
            return configCallBack.isWritable();
        return false;
    }

    public Map<String, File> getGB28181EmptyVideoFile() {
        if (configCallBack != null)
            return configCallBack.getGB28181EmptyVideoFile();
        return new HashMap<>();
    }
}
